<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="<?=base_url ( '/js/tbk.js' )?>"></script>
<style type="text/css">
<!--
div {
	font-size: 12px
}

ul {
	list-style: none;
}

ul li {
	float: left;
}

.clear {
	clear: both
}
</style>
</head>

<body>
	<h1>给力网系统基础配置</h1>
	<div>

		<ul>
			<li>可返利申请列表：</li>

		</ul>
		<div class="clear"></div>
		<table border=1>
			<tr>
				<th>ID</th>
				<th>UID</th>
				<th>UIP</th>
				<th>支付宝账号</th>
				<th>返现</th>
				<th>交易号</th>
				<th>可返现</th>
				<th>已返现</th>
				<th>提交时间</th>
				<th>返现时间</th>
				<th>操作</th>
			</tr>
	<? foreach($list as $k){ ?>
<tr>
				<td><?=$k['rid']?></td>
				<td><?=$k['uid']?></td>
				<td><?=$k['uip']?></td>
				<td><?=$k['tao_user']?></td>
				<td><?=$k['rebate_cash']?></td>
				<td><?=$k['trade_id']?></td>
				<td><?=$k['can_rebate']?></td>
				<td><?=$k['is_rebate']?></td>
				<td><?=date('Ymd',$k['submit_date'])?></td>
				<td><?=empty($k['rebate_date'])?0:date('Ymd',$k['rebate_date'])?></td>
				<? if($k['is_rebate'] ==0){ ?>
				<td><a onclick='change(<?=$k['rid'] ?>);'>done</a></td>
				<?}?>
			</tr>
<? } ?>
<? echo "<a href=".site_url('admin/rebate/index/').'/'.$prepage.">上一页</a><a href=".site_url('admin/rebate/index').'/'.$nextpage.">下一页</a>";
?>
</table>
		<div class="clear"></div>
		<ul>
			<li>
				<button onclick="tot();">更新用户返利总金额</button>
			</li>
			<li><a href="<?=site_url('admin/rebate/check_can')?>">批量更新非会员可返利申请</a>&nbsp;</li>
			<li><a href="<?=site_url('admin/rebate/user_can')?>">批量更新会员可返利申请</a></li>
			<li><a href="<?=site_url('admin/rebate/need_reb')?>">需返利列表</a></li>
		</ul>
		</form>
	</div>
	<script type="text/javascript">
<!--
function change(id){
	$.ajax({
		type:'POST',
		url:"<?=site_url('admin/rebate/done')?>",
		data:{"id":id},
		success:function (res){
			eval("var r="+res);
			alert(r);
		}
	})
}

function tot(){
	$.ajax({
		url:"<?=site_url('admin/rebate/rebate_tot')?>",
		success:function (res){
			eval("var t="+res);
			if(t.state == 1){
				alert("更新成功！"+t.sendmail+"封邮件发送失败");
			}else{
				alert("更新失败！或没有可更新数据");
			}
		}
	})
}
//-->
</script>
</body>
</html>
